package com.molichuxing.services.infrastructure.dao;

import com.molichuxing.framework.dao.RootMapper;
import com.molichuxing.services.infrastructure.bean.EnterpriseScheduleCarBean;
import com.molichuxing.services.infrastructure.dto.response.EnterpriseScheduleCarCountDto;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface EnterpriseScheduleCarMapper extends RootMapper<EnterpriseScheduleCarBean> {

    /**
     * 车辆排期信息
     *
     * @param scheduleIdList
     * @param state
     * @return
     */
    List<EnterpriseScheduleCarBean> getListByScheduleId(@Param("scheduleIdList") List<Integer> scheduleIdList, @Param("state") Integer state);

    /**
     * 通过排期id获取
     *
     * @param scheduleIdList
     * @return
     */
    List<EnterpriseScheduleCarCountDto> getCarCountByScheduleId(@Param("scheduleIdList") List<Integer> scheduleIdList);


    /**
     * 通过排期id获取
     *
     * @param scheduleIdList
     * @return
     */
    List<EnterpriseScheduleCarCountDto> getAllPayableByScheduleId(@Param("scheduleIdList") List<Integer> scheduleIdList);

    /**
     * 批量新增首付车辆排期
     *
     * @param beanList
     * @return
     */
    boolean createBatch(@Param("beanList") List<EnterpriseScheduleCarBean> beanList);

    /**
     * 终止订单车辆排期
     *
     * @param carId            车辆id
     * @param noPayState       未付款状态
     * @param terminationState 终止状态
     * @return int
     */
    int modifyTermination(@Param("carId") Integer carId,
                          @Param("noPayState") int noPayState, @Param("terminationState") int terminationState);

    /**
     * 还款修改车辆排期状态
     *
     * @param scheduleId   排期id
     * @param alreadyState 已还状态
     * @param noPayState   未还状态
     * @return int
     */
    int modifyRepay(@Param("scheduleId") Integer scheduleId, @Param("alreadyState") int alreadyState,
                    @Param("noPayState") int noPayState);

    /**
     * 根据车辆查询排期信息
     *
     * @param carId 车辆id
     * @param state 状态
     * @return
     */
    List<EnterpriseScheduleCarBean> getByCar(@Param("carId") Integer carId,
                                             @Param("state") Integer state);
}